package com.zq.learn.akka.classic;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;

/**
 * CAkkaQuickstart
 *
 * @author ZhangQi
 * @date 2020/3/13
 */
public class CAkkaQuickstart {
  public static void main(String[] args) {
    //获取ActorSystem容器
    ActorSystem system = ActorSystem.create("helloakka");
    //实例化响应Actor
    ActorRef replyTo = system.actorOf(CGreeterBot.props(3), "replyTo");
    //实例话问候Actor
    ActorRef from = system.actorOf(CGreeter.props(replyTo), "from");
    from.tell(new CGreeter.CGreet("Lime"),ActorRef.noSender());

    try{
      System.out.println(">>> Press ENTER to exit <<<");
      System.in.read();
    }catch (Exception e){
      e.printStackTrace();
    }finally {
      system.terminate();
    }
  }
}
